


import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;

public class Simulation extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int selectedUpravljac;
	private JTextArea areaAUTORI;
	private JComboBox<String> chooser;
	private JLabel labETF;
	private JLabel labAUTORI;
	private JLabel labCPU;
	private JPanel panCPU;
	private JPanel panETF;
	private JPanel panAUTORI;
	private JPanel panSTART;
	private JScrollPane scpanAUTORI;
	private JButton buttonSTART;

	public Simulation() {
		initComponents();
		setVisible(true);
	}

	private void initComponents() {
		chooser = new JComboBox<String>();
		panCPU = new JPanel();
		labCPU = new JLabel();
		panETF = new JPanel();
		labETF = new JLabel();
		panSTART = new JPanel();
		buttonSTART = new JButton();
		scpanAUTORI = new JScrollPane();
		areaAUTORI = new JTextArea();
		panAUTORI = new JPanel();
		labAUTORI = new JLabel();

		setDefaultCloseOperation(3);
		setTitle("Simulator");
		setResizable(false);

		chooser.setMaximumRowCount(4);
		chooser.setModel(new DefaultComboBoxModel<String>(new String[] {
				"Direktne Veze Ožičeno",
				"Jedna Magistrala Vertikalno Mikroprogramiranje",
				"Dve Magistrale Mešovito Mikroprogramiranje",
				"Tri Magistrale Horizontalno Mikroprogramiranje" }));

		panCPU.setLayout(new GridLayout(1, 0));

		labCPU.setIcon(new ImageIcon(getClass().getResource("NASLOVNA2.jpg")));
		panCPU.add(this.labCPU);

		panETF.setLayout(new GridLayout(1, 0));

		labETF.setHorizontalAlignment(0);
		labETF.setIcon(new ImageIcon(getClass().getResource("etfsmall.gif")));
		panETF.add(this.labETF);

		panSTART.setLayout(new GridLayout(0, 1));

		buttonSTART.setFont(new Font("Tahoma", 1, 14));
		buttonSTART.setText("Start");
		buttonSTART.setEnabled(true);
		buttonSTART.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				selectedUpravljac = chooser.getSelectedIndex();
				switch (selectedUpravljac) {
				case 0:
				    new dvoz.main.Main(Simulation.this);
					setVisible(false);
					break;
				case 1:
					new jmvm.main.Main();
					setVisible(false);
					break;
				case 2:
					new dmmm.main.Main(Simulation.this);
					setVisible(false);
					break;
				case 3:
					new tmhm.main.Main();
					setVisible(false);
					break;
				}
			}
		});
		panSTART.add(this.buttonSTART);

		scpanAUTORI.setBorder(BorderFactory.createEtchedBorder(new Color(204,
				204, 0), new Color(153, 153, 153)));

		areaAUTORI.setEditable(false);
		areaAUTORI.setColumns(20);
		areaAUTORI.setFont(new Font("Tahoma", 2, 18));
		areaAUTORI.setRows(4);
		areaAUTORI
				.setText("\t    Vuk Mirović\t    \n\t    Đorđe Miladinović\n\t    Darko Tamburić\n\t    Aleksandar Milić");
		areaAUTORI.setFocusable(false);
		scpanAUTORI.setViewportView(this.areaAUTORI);

		panAUTORI.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
		panAUTORI.setLayout(new GridLayout(1, 0));

		labAUTORI.setFont(new Font("Tahoma", 2, 12));
		labAUTORI.setHorizontalAlignment(0);
		labAUTORI.setText("Autori");
		labAUTORI.setHorizontalTextPosition(0);
		panAUTORI.add(this.labAUTORI);

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING)
												.addComponent(this.scpanAUTORI)
												.addComponent(this.panCPU, -2,
														-1, -2)
												.addComponent(this.panAUTORI,
														-1, -1, 32767)
												.addComponent(this.chooser, 0,
														-1, 32767))
								.addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.LEADING)
												.addComponent(this.panSTART,
														-1, 168, 32767)
												.addComponent(this.panETF, -1,
														168, 32767))
								.addContainerGap()));

		layout.setVerticalGroup(layout.createParallelGroup(
				GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addGroup(
										layout.createParallelGroup(
												GroupLayout.Alignment.TRAILING)
												.addComponent(this.panETF, -1,
														-1, 32767)
												.addComponent(this.panCPU, -1,
														-1, 32767))
								.addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(this.panSTART, -2, -1, -2)
								.addPreferredGap(
										LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(this.chooser, -2, -1, -2)
								.addGap(18, 18, 18)
								.addComponent(this.panAUTORI, -2, 20, -2)
								.addGap(2, 2, 2)
								.addComponent(this.scpanAUTORI, -2, 138, -2)
								.addContainerGap()));

		pack();
	}

	public static void main(String[] args) {
		new Simulation();
	}
}